<!DOCTYPE html>
<html>
<head>
    <title>终端列表</title>
    <#include "/header.html">
    <link type="text/css" rel="stylesheet" href="${request.contextPath}/statics/plugins/layui/css/layui.css">
    <script type="text/javascript" charset="utf-8"
            src="${request.contextPath}/statics/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8"
            src="${request.contextPath}/statics/ueditor/ueditor.all.min.js"></script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8"
            src="${request.contextPath}/statics/ueditor/lang/zh-cn/zh-cn.js"></script>
    <style>
        th {
            text-align: center;
        }

        .form-control {
            margin-left: 5px;
        }
        #rrapp a{
            cursor: pointer;
            text-underline: none;
        }
    </style>

</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">

            <div class="form-group">
                <div class="layui-inline" style="width: 120px">
                    <select class="layui-input layui-unselect" v-model="q.state">
                        <option v-for="state in this.states" :value="state.value">{{state.msg}}</option>
                    </select>
                </div>
                <div class="layui-inline" style="width: 120px">
                    <select class="layui-input layui-unselect" v-model="q.type">
                        <option v-for="type in this.types" :value="type.value">{{type.msg}}</option>
                    </select>
                </div>
                <div class="layui-inline">
                    <input type="button" class="btn btn-primary form-control" @click="query" value="查询"/>
                </div>
                <div class="layui-inline">
                    <input type="button" class="btn btn-primary form-control" @click="clean" value="刷新"/>
                </div>
                <div class="layui-inline">
                    <input type="button" class="btn btn-primary form-control" @click="add" value="新增"/>
                </div>
                <div class="layui-inline">
                    <input type="button" class="btn btn-primary form-control" @click="update" value="修改"/>
                </div>
                <div class="layui-inline">
                    <input type="button" class="btn btn-primary form-control" @click="deleteArticle" value="删除"/>
                </div>
                <div class="layui-inline">
                    <input type="button" class="btn btn-primary form-control" @click="showCover" value="查看封面"/>
                </div>
            </div>
            <table id="jqGrid"></table>

            <div id="jqGridPager"></div>


        </div>
    </div>

    <div v-show="showImgList" id="imgList">
        <div class="grid-btn">

            <div class="form-group">
                <div class="layui-inline">
                    <input type="button" class="btn btn-primary form-control" @click="clean" value="返回"/>
                </div>
            </div>
            <table id="imgGrid" width="100%"></table>

            <div id="imgGridPager"></div>
        </div>
    </div>


    <div v-show="showUpdate" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-2 control-label">id</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="article.articleId" readonly="readonly"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">标题</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="article.title"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">作者</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="article.author"/>
                </div>
            </div>
            <div class="form-group" v-show="showAdd">
                <div class="col-sm-2 control-label">作者头像</div>
                <div class="col-sm-10">
                    <input type="file" name="file" id="head"/>
                </div>
            </div>
            <div class="form-group"  v-show="showAdd">
                <div class="col-sm-2 control-label">类型</div>
                <div class="col-sm-10">
                    <select v-model="article.type" class="form-control">
                        <option v-for="type in this.types" :value="type.value">{{type.msg}}</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">创作时间</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" readonly="readonly" id="writeDate"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">状态</div>
                <div class="col-sm-10">
                    <select class="layui-input layui-unselect" v-model="article.state">
                        <option v-for="state in this.states" :value="state.value">{{state.msg}}</option>
                    </select>
                </div>
            </div>
            <div class="form-group" v-show="showAdd">
                <div class="col-sm-2 control-label">封面图片</div>
                <div class="col-sm-10">
                    <input type="file" name="file" multiple id="cover"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">内容</div>
                <div class="col-sm-10">
                    <div id="editor" type="text/plain" style="width:800px;height:300px;">

                    </div>

                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="modify" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>


</div>

<script src="${request.contextPath}/statics/js/modules/discover/articlelist.js?_${.now?long}"></script>
<script src="${request.contextPath}/statics/plugins/layui/layui.js"></script>
<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //常规用法
        laydate.render({
            elem: '#writeDate',
            format: 'yyyy-MM-dd',
            value: new Date(),
            done: function (value, date) {
                vm.article.writeDate = value;
            }
        });
    })

</script>
</body>
<div id="content" style="display: none;width: 375px;height: 667px">

</div>
<img src="" width="720px" height="auto" style="display: none;" id="goodsImg">

<div id="imgForm" style="display: none;width: 100%">
    <form style="width: 90%;margin-left: 5%;margin-top: 10%" class="form-group">
        <input type="file" name="file" class="form-control" placeholder="请选择文件"/>
    </form>
</div>

</html>